//
//  UIView+BackGround.m
//  AILock
//
//  Created by 谭亚明 on 2020/6/19.
//  Copyright © 2020 tym. All rights reserved.
//

#import "UIView+BackGround.h"

@implementation UIView (BackGround)

-(void)setBtnBackgroundColor{
    CAGradientLayer *gl = [CAGradientLayer layer];
    gl.frame = self.bounds;
    gl.startPoint = CGPointMake(0, 0.5);
    gl.endPoint = CGPointMake(1, 0.5);
    gl.colors = @[(__bridge id)[UIColor colorWithRed:139/255.0 green:175/255.0 blue:255/255.0 alpha:1.0].CGColor, (__bridge id)[UIColor colorWithRed:76/255.0 green:132/255.0 blue:255/255.0 alpha:1.0].CGColor];
    gl.locations = @[@(0), @(1.0f)];
    self.layer.cornerRadius = 5;
    self.layer.masksToBounds = YES;
    [self.layer addSublayer:gl];
}

-(void)setWhiteViewShadow{
    self.layer.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0].CGColor;
    self.layer.cornerRadius = 4.5;
    self.layer.shadowColor = [UIColor colorWithRed:230/255.0 green:230/255.0 blue:230/255.0 alpha:0.5].CGColor;
    self.layer.shadowOffset = CGSizeMake(0,0);
    self.layer.shadowOpacity = 1;
    self.layer.shadowRadius = 14;
}

@end
